home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kellogg's Amérique
/
Kellogg's Amérique
/
decouverte_amerique.swf
/
scripts
/
elements
/
Bouton.as
Wrap
Text File
|
2020-08-04
|
2KB
|
65 lines
package elements
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class Bouton extends MovieClip
{
public var clicable:Boolean = true;
private var targetFrame:int = 0;
public var activated:Boolean = false;
public function Bouton()
{
activated = false;
clicable = true;
targetFrame = 0;
super();
gotoAndStop(1);
buttonMode = true;
addEventListener(MouseEvent.MOUSE_OVER,_survole);
}
private function _survole(param1:MouseEvent) : void
{
targetFrame = 5;
addEventListener(Event.ENTER_FRAME,_framing);
removeEventListener(MouseEvent.MOUSE_OVER,_survole);
addEventListener(MouseEvent.MOUSE_OUT,_sort);
}
private function _sort(param1:MouseEvent) : void
{
targetFrame = 1;
addEventListener(Event.ENTER_FRAME,_framing);
addEventListener(MouseEvent.MOUSE_OVER,_survole);
removeEventListener(MouseEvent.MOUSE_OUT,_sort);
}
private function _framing(param1:Event) : void
{
if(targetFrame == 0)
{
return;
}
if(currentFrame == targetFrame)
{
removeEventListener(Event.ENTER_FRAME,_framing);
}
if(currentFrame > targetFrame)
{
prevFrame();
}
if(currentFrame < targetFrame)
{
nextFrame();
}
}
}
}